package com.nepu.spark.realtime.util

import java.text.SimpleDateFormat
import java.util.Date

import com.nepu.spark.realtime.constant.DateConstant

/**
  * 日期的工具类
  *
  * @author chenshuaijun
  * @create 2022-11-01 11:08
  */
object MyDateUtils {

  def parseTs(ts: Long, format: String): String = {
    val dfs = new SimpleDateFormat(format)
    val date = new Date(ts)
    val dataStr: String = dfs.format(date)
    dataStr
  }

  def main(args: Array[String]): Unit = {
    val ts: Long = System.currentTimeMillis()
    println(DateConstant.YMD_HMS)
    println(MyDateUtils.parseTs(ts, DateConstant.YMD_HMS))
  }
}
